package ${packagePrefix}.application.executor.${tableName?lower_case};

import ${packagePrefix}.application.assembler.${domainObjectName}Assembler;
import ${packagePrefix}.client.dto.data.${domainObjectName}DTO;
import ${packagePrefix}.client.dto.query.${domainObjectName}ListQry;
import ${packagePrefix}.domain.gateway.${domainObjectName}Gateway;
import ${packagePrefix}.domain.model.${tableName?lower_case}.${domainObjectName};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.cola.dto.MultiResponse;

import java.util.List;
import java.util.stream.Collectors;

/**
 * ${entityComment}列表查询执行器
 */
@Component
public class ${domainObjectName}ListQryExe {

    @Autowired
    private ${domainObjectName}Gateway ${domainObjectName?uncap_first}Gateway;

    @Autowired
    private ${domainObjectName}Assembler ${domainObjectName?uncap_first}Assembler;

    /**
     * 执行${entityComment}列表查询
     *
     * @param qry ${entityComment}列表查询对象
     * @return ${entityComment}DTO列表
     */
    public MultiResponse<${domainObjectName}DTO> execute(${domainObjectName}ListQry qry) {
        // 查询领域实体列表
        List<${domainObjectName}> ${domainObjectName?uncap_first}List = ${domainObjectName?uncap_first}Gateway.findByCondition(qry);
        
        // 转换为DTO列表
        List<${domainObjectName}DTO> dtoList = ${domainObjectName?uncap_first}List.stream()
                .map(${domainObjectName?uncap_first}Assembler::toDTO)
                .collect(Collectors.toList());
        
        return MultiResponse.of(dtoList);
    }
} 